/**
 * Project: TacticaPescaditos
 * File: PlayerBase.java
 */
package org.javahispano.javacup.tacticas_aceptadas.Pescaditos.com.chidotronics.javacup;

import org.javahispano.javacup.modelo.Constantes;
import org.javahispano.javacup.modelo.JugadorDetalle;

import org.javahispano.javacup.tacticas_aceptadas.Pescaditos.com.chidotronics.javacup.fsm.StateMachine;
import org.javahispano.javacup.tacticas_aceptadas.Pescaditos.com.chidotronics.javacup.fsm.state.GlobalPlayerState;
import org.javahispano.javacup.tacticas_aceptadas.Pescaditos.com.chidotronics.javacup.fsm.state.Wait;
import org.javahispano.javacup.tacticas_aceptadas.Pescaditos.com.chidotronics.javacup.geometrics.Vector2D;
import org.javahispano.javacup.tacticas_aceptadas.Pescaditos.com.chidotronics.javacup.messages.Telegram;


/**
 * @author Carlos Alberto
 * class: PlayerBase
 */
public class TeamPlayer extends Player<TeamPlayer> {
	
	


	protected StateMachine<TeamPlayer> stateMachine;
	
	
	@Override
	public boolean canKick() {
		return !owner.isKickGoal() && super.canKick();
	}
	


	
	/**
	 * @param detail
	 * @param homePosition 
	 * @param homePosition 
	 */
	public TeamPlayer(TacticaPescaditos tacticaPescaditos, JugadorDetalle detail, PLAYER_ROLE playerRole) {
		super(tacticaPescaditos,detail,playerRole, Constantes.ALTURA_CONTROL_BALON);
		stateMachine = new StateMachine<TeamPlayer>(this);
		stateMachine.setGlobalState(GlobalPlayerState.instance);
		
		stateMachine.setCurrentState( Wait.instance);
		stateMachine.getCurrentState().enter(this);
		
	}





	
	
	public void resetStateMachine() {	
		stateMachine.changeState( Wait.instance);
	}





	/**
	 * @return the stateMachine
	 */
	public StateMachine<TeamPlayer> getStateMachine() {
		return stateMachine;
	}





	public void handleMessage(Telegram telegram) {
		 stateMachine.handleMessage(telegram);
	}































	
}
